import ToolActionApi from "@/tool/http/tool-action.js";

let dictAction = ToolActionApi.init("common_dict");

let dictPid = [];

const rule = {
  queryParams: [],
  metadata: [
    { name: "name" },
    { name: "user_id", hidden: true },
    { name: "pid", memo: "父节点", dictListFun: () => dictPid },
  ],
  metaConfig: {
    id: { name: "id" },
    user_id: {
      hidden: true,
    },
  },
  listData: dictAction.tree,
};

export default async function () {
  dictPid = [{ name: "默认", val: 0, children: await dictAction.tree() }];
  return rule;
}
